import requests
import time,unittest,os

class Woniuboss(unittest.TestCase):

    def setUp(self):
        print('####开始测试####\n')
        loginData = {'userName': 'WNCD056', 'userPass': 'Woniu123', 'checkcode': '0000', 'remember': 'Y'}
        r = requests.post("http://192.168.1.162:8080/woniuboss3.5/login/userLogin", loginData)
        self.cookie = r.cookies

    def tearDown(self):
        print('####测试完成####')

    #登录
    def test01(self):
        addData = {'s_consulttime':'2019-06-18','e_consulttime':'2019-06-21','showType':''}
        addr = requests.post('http://192.168.1.162:8080/woniuboss3.5/counsulting/countByCounselor',data=addData,cookies=self.cookie)
        print(addr.text)
        self.assertIn("成都",addr.text)

    def test03(cls):
        addData = {'pageSize': '10', 'pageIndex': '1', 's_consulttime': '', 'e_consulttime': '2019-06-21'}
        addr = requests.post('http://192.168.1.162:8080/woniuboss3.5/reportJob/queryJobInfo?selectTime=',
                             data=addData, cookies=cls.cookie)
        print(addr.text)
        cls.assertIn("苏珊", addr.text)


    # def test02(self):
    #     addData = {'s_consulttime':'','e_consulttime':'','showType':'today'}
    #     addr = requests.post('http://192.168.1.162:8080/woniuboss3.5/counsulting/countByCounselor',data=addData,cookies=self.cookie)
    #     print(addr.text)
    #     self.assertIn("成都",addr.text)





if __name__ == '__main__':
    # unittest.main()
    suite = unittest.TestSuite()
    loader = unittest.TestLoader()
    suite.addTests(loader.loadTestsFromTestCase(Woniuboss))
    r = unittest.TestResult()
    suite.run(result=r)
    print(r)
